<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>js函数之回调函数</title>
</head>
<body>
  <ul>
    <li>回调函数即在其他函数的内部调用，以匿名函数形式出现</li>
    <li>回调函数常用于事件处理，数组操作</li>
  </ul>
  <button name="callback">回调</button>
  <script>
    document.querySelector('[name="callback"]').addEventListener('click', function() {
      alert(this.innerHTML)
    })
    const nums = [1, 2, 3, 4, 5]
    // [10, 20, 30, 40, 50]
    console.log(nums.map(function(item) {
      item = item * 10
      return item
    }))
  </script>
</body>
</html>